package ocean.chinacraft.common.world.item.jade;

import ocean.chinacraft.common.config.GroupDefine;
import ocean.chinacraft.common.world.item.ModJade;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.Effects;
import net.minecraft.world.World;

/**
 * 芙蓉玉
 *
 * @author zhang
 * @since 2021/11/20
 */
public class HibiscusJade extends ModJade {

    public HibiscusJade() {
        super(new Properties().tab(GroupDefine.CHINACRAFT_MISC).stacksTo(1));
    }

    @Override
    public void inventoryTick(ItemStack itemStack, World world, Entity entity, int index, boolean flag) {
        if (entity instanceof PlayerEntity && entity.isAlive()) {
            ((PlayerEntity) entity).addEffect(new EffectInstance(Effects.FIRE_RESISTANCE, 20, 0, false, false));
        }
    }
}
